package com.mdx.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mdx.bean.DiseaseBean;
import com.mdx.bean.RegionBean;
import com.mdx.dao.RegionDao;
import com.mdx.service.IRegionService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class RegionServiceImpl extends ServiceImpl<RegionDao,RegionBean> implements IRegionService {


    @Override
    public IPage<RegionBean> findByNameKindAndClassName(int pageNO,
                                                        int pageSize,
                                                        String regionName,
                                                        String regionKind,
                                                        String className) {
        IPage<RegionBean> page = new Page<>(pageNO,pageSize);
        QueryWrapper wrapper = new QueryWrapper();
        if (regionName != null && !regionName.equals("")){
            wrapper.like("f_regionName",regionName);
        }
        if (regionKind != null && !regionKind.equals("")){
            wrapper.like("f_regionKind",regionKind);
        }
        if (className != null && !className.equals("")){
            wrapper.like("f_className",className);
        }
        IPage<RegionBean> iPage = this.page(page,wrapper);
        return iPage;
    }
}
